fix: skip duplicate HTTP status lines in ReadResponse#542
Merged
Mzack9999 merged 2 commits intoJun 16, 2026
Conversation
Some non-compliant servers (e.g. Grandstream HT801 firmware 1.0.13.7) emit the HTTP status line more than once before the actual headers: HTTP/1.0 200 OK\r\n HTTP/1.0 200 OK\r\n <- duplicate Content-Type: text/html\r\n ... The rawhttp parser passes header lines to ReadHeader(), which splits on ':'. A duplicate status line has no ':', so parsing fails with: malformed MIME header: missing colon: "HTTP/1.0 200 OK" This propagates to Nuclei as a fatal request error even under unsafe: true, preventing matchers from ever running. Fix: after reading the first status line in ReadResponse(), peek ahead and discard any additional lines that start with 'HTTP/' before entering the header-reading loop. Adds regression tests for duplicate and triple status lines. Fixes projectdiscovery#541 Related: projectdiscovery/nuclei#7363
Mzack9999
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some non-compliant servers (e.g. Grandstream HT801 firmware 1.0.13.7) emit the HTTP status line more than once before actual headers:
ReadHeader()splits on:. A repeated status line has no:, so parsing fails with:This error propagates to Nuclei as a fatal request error even under
unsafe: true, preventing matchers from ever running.Fix
After reading the first status line in
ReadResponse(), peek ahead and discard any additional lines that start withHTTP/before entering the header-reading loop. The change is minimal (< 15 lines) and touches only the one code path.Tests
Two new regression tests added to
client/reader_test.go:TestReadResponseDuplicateStatusLines— double status line with a bodyTestReadResponseTripleStatusLines— triple status lineAll existing tests continue to pass (
go test ./...).Related